package com.tongren.framework.me.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.tongren.framework.R;
import com.tongren.framework.core.BaseActivity;

public class WebViewActivity extends BaseActivity implements View.OnClickListener {

    private WebView webView;
    @Override
    protected void setUpContentView() {
        setContentView(R.layout.activity_web_view,R.string.title_framework_main);
    }

    @Override
    protected void setUpView() {
        webView = (WebView) findViewById(R.id.webView);
    }

    @Override
    protected void setUpData(Bundle savedInstanceState) {
        //启用支持javascript
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        webView.loadUrl("https://www.baidu.com");
//        webView.setWebViewClient(new WebViewClient(){
//            @Override
//            public boolean shouldOverrideUrlLoading(WebView view, String url) {
//                // TODO Auto-generated method stub
//                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
//                view.loadUrl(url);
//                return true;
//            }
//        });
    }

    @Override
    public void onClick(View view) {

    }
}
